<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>文档管理</title>

    <!-- Bootstrap core CSS -->
    <link th:href="@{/webjars/bootstrap/4.3.1/css/bootstrap.css}" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link th:href="@{/asserts/css/dashboard.css}" rel="stylesheet">
    <!-- 通知栏样式 -->
    <link th:href="@{/asserts/css/notificationBar.css}" rel="stylesheet">
</head>
<body onload="syncNotify()">
    <!-- 引入顶部栏 -->
    <div th:replace="common/bar::topbar"></div>

    <div class="container-fluid">
        <div class="row">
            <!-- 引入通知栏 -->
            <div th:replace="common/bar::NotificationBar"></div>
            <!-- 引入侧边栏 -->
            <div th:replace="common/bar::#sidebar(activeUri='docMan')"></div>
            <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
                <h2 th:if="${session.login_usr_role == 0}">文档管理</h2>
                <div class="table-responsive" style="overflow:auto;">
                    <table class="table table-striped table-sm" style='white-space: nowrap'>
                        <thead>
                        <tr align="center">
                            <th colspan="2">编辑文档</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr align="center">
                            <td colspan="2">
                                <textarea id="docContent" cols="160" rows="25" style="OVERFLOW:auto">[[${document_content}]]</textarea>
                            </td>
                        </tr>
                        <tr align="center">
                            <td>
                                <button onclick="return copyContent()" class="btn btn-sm btn-success">复制内容</button>
                            </td>
                            <td>
                                <button onclick="return updateDocument()" class="btn btn-sm btn-primary">保存&更新</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </main>
        </div>
    </div>

    <!-- 引入公共的js  -->
    <div th:replace="common/js::js"></div>
    <!-- 自定义的js -->
    <script type="text/javascript" th:src="@{/asserts/js/common.js}" ></script>

    <script>
        function copyContent() {
            var input = document.querySelector('#docContent');
            input.select();
            if (document.execCommand('copy')) {
                document.execCommand('copy');
                console.log('复制内容成功...');
            }
        }
    </script>

</body>
</html>